package net.microfigure.mapper;

import net.microfigure.model.IllCard;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;

/**
 * <p>
  * 慢性病证表 Mapper 接口
 * </p>
 *
 * @author 林景锋
 * @since 2018-06-25
 */
public interface IllCardMapper extends BaseMapper<IllCard> {

	
	@Select("select CONCAT(ill_card_no,LPAD(SUBSTR(max(ill_card_no),18)+1,2,0))  "
			+ "from ill_card    "
			+ "where part_no=#{preFix}")
	String sQLQuery(String preFix);

	@Select("select ill_card_no AS illCardNo,part_no AS partNo,card_no AS cardNo,"
			+ "ill_name AS illName,start_day AS startDay,end_day AS endDay,id from ill_card where card_no = #{cardNo}")
	List<IllCard> selectListByCardNo(String cardNo);

	@Select("select * from ill_card where start_day<#{recodTime} and end_day>#{recodTime}")
	List<IllCard> equalsByRecodTime(Date recodTime);

}